var _inherit = require('core/inherit.js');
var MOVE_LEFT = 0;
var MOVE_TOP = 1;
var MOVE_RIGHT = 2;
var MOVE_BOTTOM = 3;

var S = require('res/style.js');

// ==========================
// Toturials
// ==========================
function Step() {
    this.mToturial = null;
    this.mLocal = null;
}
Step.prototype._onStart = Step.prototype.onStart = function (toturial, local) {
};
/**
 * @param accepted cell will move to next position
 */
Step.prototype._onAbsorbStart = Step.prototype.onAbsorbStart = function (accepted) {
};
/**
 * absorb has just finish
 * @type {Function}
 * @private
 */
Step.prototype._onMergeBefore = Step.prototype.onMergeBefore = function (cells) {
};
/**
 * after absobr and these cells has merged
 * @type {Function}
 * @private
 */
Step.prototype._onMergeFinish = Step.prototype.onMergeFinish = function (cells) {
};
/**
 * called when slidein finish
 */
Step.prototype._onSlideinStart = Step.prototype.onSlideinStart = function (cell) {
};
Step.prototype._onSlideinFinish = Step.prototype.onSlideinFinish = function () {
};
Step.prototype.alineRight = function (rtf) {
    rtf.setAnchor(1, 0.5);
    rtf.setPosition(192, 0);
    return rtf;
};
Step.prototype.rtfHeader = function () {
    var text = S.toturial.header.rtf.createRtf();
    text.setAnchor(0.5, 0.5);
    return text;
};
Step.prototype.equationHeader = function () {
    var text = S.toturial.header.equation.createRtf();
    text.setAnchor(0.5, 0.5);
    return text;
};
Step.prototype.createHeader = function (text) {
    var text = S.toturial.header.normal.createText(text);
    text.setAnchor(0.5, 0.5);
    return text;
};
Step.prototype.hasSlot = function (count) {
    var cells = this.mLocal.find('gamearea.cells');
    var itor = cells.startItor(MOVE_LEFT);
    while (itor.nextLine()) {
        while (itor.hasNext()) {
            var slot = itor.next();
            if (!slot.isEmpty() && slot.getCell().getCount() >= count) {
                return true;
            }
        }
    }
    return false;
};

module.exports = Step;